<template>
  <div class="teacher">
    <h1>老师姓名：{{name}}</h1>
    <h1>老师性别：{{sex}}</h1>
    <button @click="sendTeacherName">点我将老师名字,性别传递给App</button>
  </div>
</template>

<script>
    export default {
      name: "Teacher",
      data(){
        return{
          name:'李四',
          sex:'女'
        }
      },
      methods:{
        sendTeacherName(){
          this.$emit('tName',this.name,this.sex)
        }
      }
    }
</script>

<style scoped>
.teacher{
  background-color: yellow;
}
</style>
